<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of FinalizarPracticas
 *
 * @author MFerreira
 */
class FinalizarPracticas extends Module {

    public function index() {
        $Solicitudes = $this->model->applications->GetByEstado(EstadoSolicitud::Procesada);
        $this->assign("Solicitudes", $Solicitudes);

        $this->display();
    }

    /**
     * @export-metadata Bind:this.Solicitud
     */
    public function Save() {
        if ($this->request->submitted()) {
            $this->Solicitud->setEstado(EstadoSolicitud::Finalizada);
            $this->module->applications->Update($this->Solicitud);
            $this->display();
        } else {
            $this->index();
        }
    }
    
    private $Solicitud;
    
    public function getSolicitud() {
        if(!$this->Solicitud){
            $this->Solicitud = new Solicitudes();
        }
        return $this->Solicitud;
    }
}

?>
